﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class Manage_CompanyNoPass : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAdmin);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAttorney);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumCheckCompany);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumBidGoods);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumComapanyRG);
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {
            if (!IsPostBack)
            {
                Int64 AccountId;
                AccountId = Int64.Parse(SysFun.IsSQL(Request.QueryString["AccountId"]));
                string strsele = " select memo6 from company where accountid ='" + AccountId + "'";
                Db db = new Db();
                DataTable dt = db.DataTable(strsele);
                db.Close();
                if (dt != null && dt.Rows.Count > 0)
                {
                    TextBox1.Text = dt.Rows[0].ItemArray[0].ToString();
                }
                dt.Dispose();
            }
        }

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (SysFun.ToTrim(TextBox1.Text.ToString()) == "")
        {
            Response.Write("<script>alert('审核未通过的原因不能为空！！！');</script>");
        }
        else
        {
            Int64 AccountId_SH, AccountId;
            string strSql;
            AccountId = Int64.Parse(SysFun.IsSQL(Request.QueryString["AccountId"]));
            HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
            if (_Account != null)
            {
                AccountId_SH = SysFun.ToLong(_Account.AccountId);

                Db db = new Db();
                strSql = "update Company set memo6='" + SysFun.ToTrim(TextBox1.Text.ToString()) + "',AccountId_SH='" + AccountId_SH + "',checktime=getdate() where AccountId=" + AccountId.ToString();
                db.Command(strSql);
                db.Close();
                //HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
                HZ.MBSM.BLL.LogManage.RecordLoginDetail(_Account.AccountName, Request.UserHostAddress, "更新", "Company", strSql, "../Magage/CompanyNoPass.aspx");

                Response.Write("<script>window.opener.location.reload();window.close();</script>");
            }
            else
            {
                Response.Write("<script language=JavaScript>alert('您无权审核企业信息！！！');</script>");
            }

        }
    }
}
